<div v-cloak id="app" class="main-content">
    <div class="form-body">
        <el-button class="button-item" :loading="loading" type="primary" @click="store()" size="small">
            保存
        </el-button>
        
        <one-form :config="baseConfig" v-model="fdata" ref="baseForm">
            <div slot='menuLeft'>
                <h3>开放平台设置</h3>
            </div>
        </one-form>
        <one-form :config="paramConfig" v-model="fdata" ref="paramForm">
            <div slot='menuLeft'>
                <h3>开放平台通信</h3>
            </div>
            <template slot='form-item-end' slot-scope="scope">
                <span v-if="scope.row.copy" style="left:400px;position: absolute;font-size:12px" class="copy-text" @click="copyText" :data-clipboard-text="fdata[scope.row.prop]">复制</span>
            </template>
        </one-form>
        <one-form :config="payConfig" v-model="fdata" ref="payForm">
            <div slot='menuLeft'>
                <h3>支付服务商</h3>
            </div>
        </one-form>
        <one-form :config="otherConfig" v-model="fdata" ref="otherForm">
            <div slot='menuLeft'>
                <h3>应用配置(可配置为服务商下任意APPID,用于公共参数查询)</h3>
            </div>
        </one-form>
    </div>
</div>
{include file='common@components/one-form'}
<script>
    const _formData = {:json_encode($formData, 256)};
    const app = new Vue({
        el: '#app',
        data() {
            return {
                loading: false,
                fdata: _formData || {},
                baseConfig: {
                    labelWidth:'200px',
                    formdesc: [{
                        label: "APPID :",
                        prop: "open_appid",
                        type: "input",
                        value:'',
                        content: "微信第三方平台AppId",
                        bind: {
                            'placeholder': "微信第三方平台AppId",
                        },
                    }, {
                        label: "SECRET :",
                        prop: "open_secret",
                        type: "input",
                        value:'',
                        content: "微信第三方平台SECRET",
                        bind: {
                            'placeholder': "微信第三方平台SECRET",
                        },
                    }]
                },
                paramConfig: {
                    labelWidth:'200px',
                    formdesc: [{
                        label: "消息校验Token :",
                        prop: "open_token",
                        type: "input",
                        value:'',
                        content: "消息校验Token",
                        bind: {
                            'placeholder': "消息校验Token",
                        },
                    }, {
                        label: "消息加解密Key :",
                        prop: "open_key",
                        type: "input",
                        value:'',
                        content: "消息加解密Key",
                        bind: {
                            'placeholder': "微信第三方平台SECRET",
                        },
                    }, {
                        label: "授权发起页域名：",
                        prop: "open_auth_domain",
                        type: "input",
                        value:'',
                        content: "授权发起页域名：",
                        copy:true,
                        bind: {
                            'disabled': true,
                        },
                    }, {
                        label: "授权事件接收URL",
                        prop: "open_ticket_url",
                        type: "input",
                        value:'',
                        content: "授权事件接收URL",
                        copy:true,
                        bind: {
                            'disabled': true,
                        },
                    }, {
                        label: "消息与事件接收URL",
                        prop: "open_msg_url",
                        type: "input",
                        value:'',
                        content: "消息与事件接收URL",
                        copy:true,
                        bind: {
                            'disabled': true,
                        },
                    }]
                },
                payConfig: {
                    labelWidth:'200px',
                    formdesc: [{
                        label: "APPID :",
                        prop: "pay_appid",
                        type: "input",
                        value:'',
                        content: "微信第三方平台AppId",
                        bind: {
                            'placeholder': "微信第三方平台AppId",
                        },
                    }, {
                        label: "SECRET :",
                        prop: "pay_secret",
                        type: "input",
                        value:'',
                        content: "微信第三方平台SECRET",
                        bind: {
                            'placeholder': "微信第三方平台SECRET",
                        },
                    }]
                },
                otherConfig: {
                    labelWidth:'200px',
                    formdesc: [{
                        label: "APPID :",
                        prop: "other_appid",
                        type: "input",
                        value:'',
                        content: "微信第三方平台AppId",
                        bind: {
                            'placeholder': "微信第三方平台AppId",
                        },
                    }, {
                        label: "SECRET :",
                        prop: "other_secret",
                        type: "input",
                        value:'',
                        content: "微信第三方平台SECRET",
                        bind: {
                            'placeholder': "微信第三方平台SECRET",
                        },
                    }]
                },
            }
        },
        created() {            
        },
        methods: {
          
            store() {
                let _this = this;
                // 获取到组件中的form
                _this.loading = true
                request({
                    params: {
                        s: 'one_wxopen/config/index',
                    },
                    data:_this.fdata,
                    method: 'post'
                }).then(e => {
                    _this.loading = false
                })

            },
        }
    })
</script>
<style>
    h3{
        border-left:5px solid #00C250;
        padding-left:10px;

    }
</style>